<div class="heading">
    <div class="left_heading"></div>
                                
    <div class="content_heading">
        <h3>Quản lý địa điểm</h3>
    </div>
                                
    <div class="right_heading"></div>
</div><!-- End .heading -->

<div class="main_content">
    <div class="table_form">      
        <form class="list_cat_form" name="list_cat_form" action="" method="post">
        <div style="float: right;">
        	<p id="add_form">Số lượng: <span class="msg"><?php echo $this->total; ?></span> địa điểm</p>
	        <?php echo $this->formSubmit('add', 'Thêm mới', array('class' => 'button', 'id' => 'add_form')); ?>
	        <?php echo $this->formSubmit('refresh', 'Làm mới', array('class' => 'button', 'id' => 'add_form')); ?>
	        <?php echo $this->formSubmit('orders', 'Sắp xếp', array('class' => 'button', 'id' => 'del_form')); ?>
        </div>
        <table class="table_style">
            <tr class="head_table">
                <td width="250px">Tên địa điểm</td>
                <td width="50px">Sắp xếp</td>
                <td width="50px">Trạng thái</td>
                <td class="tools">&nbsp;</td>
                <td class="tools">&nbsp;</td>
            </tr>
            <?php
                if(count($this->data) > 0) :
            	$place = new Admin_Model_Place();
                $orderArr = $place->orderGroup($this->data);
            	foreach($this->data as $value) : 
		            $levelCss = '';
		            if($value['level'] == 0){
		            	$name = '<b style="color:red">' . $value['place_name'] . '</b>';
		            }else if($value['level'] == 1){
		            	$name = '<b> + ' . $value['place_name'] . '</b>';
		            }else{
		            	$name = '<b> - - ' . $value['place_name'] . '</b>';
		            	$levelCss =  'padding-left: ' . (20 * $value['level']) . 'px;';
		            }
	            
		            $orderName	= 'ordering[' . $value['lft'] . ']';
		            $orderValue	= $place->getNodeOrdering($value['parents'],$value['lft']);
            ?>
            <tr class="records">
                <td style="<?php echo $levelCss;?>"><?php echo $name; ?></td>
                <td><?php echo $this->formText($orderName, $orderValue, array(
                		'size' => 4, 
                		'id' => $orderName, 
                		'style' => 'text-align: center'
                	)); ?></td>
                <td><?php
               		if($value['status'] == 1)
               		{
               			echo 'Hiển thị';
               		}
               		else
               		{
               			echo 'Ẩn đi';
               		} ?></td>
                <td><a class="edit" title="Sửa" href="<?php echo $this->baseUrl('/admin/place/edit?place_id=' . $value['place_id']); ?>"></a></td>
                <td><a class="remove" title="Xóa" onclick="return remove_alert()" href="<?php echo $this->baseUrl('/admin/place/delete?place_id=' . $value['place_id']); ?>"></a></td>
            </tr>
            <?php 
                endforeach;
                else :
            ?>
            <tr class="records">
            	<td colspan="10">Hiện không có địa điểm nào</td>
            </tr>
            <?php endif; ?>
        </table>
        </form>
    </div>
</div><!-- End .main_content -->  